package models

//商品模型
type Commodity struct {
	Id                 int     `gorm:"primary_key json:"id" form:"id"`
	Name               string  `json:"name" form:"name"`                                 //商品名称
	Introduce          string  `json:"introduce" form:"introduce"`                       //商品描述
	UnitPrice          float32 `json:"unit_price" form:"unit_price"`                     //单价
	Image              string  `json:"image" form:"image"`                               //图片
	Classification     int     `json:"classification" form:"classification"`             //类别
	Type               int     `json:"type" form:"type"`                                 //商品状态（0.停止销售；1.正在销售）
	StoryId            int     `json:"story_id" form:"story_id"`                         //所属商铺
	CommoditySpeciesId int     `json:"commodity_species_id" form:"commodity_species_id"` //商品类别
	Updatetime         string  `json:"updatetime" form:"updatetime"`                     //更新时间
	Createtime         string  `json:"createtime" form:"createtime"`                     //创建时间
	Details            string  `json:"details" form:"details"`                           //详情
	Service            string  `json:"service" form:"service"`                           //售后服务
}

//商品类别
type CommoditySpecies struct {
	Id       int    `gorm:"primary_key json:"id" form:"id"`
	Name     string `json:"name" form:"name"`           //类别名称
	FatherId int    `json:"father_id" form:"father_id"` //父类id
}

func (Commodity) TableName() string {
	return "commodity"
}

func (CommoditySpecies) TableName() string {
	return "commodity_species"
}
